package com.jiyun.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.mapper.PersonalMapper;
import com.jiyun.pojo.*;
import com.jiyun.service.PersonalService;
import com.jiyun.utils.R;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PersonalServiceImpl extends ServiceImpl<PersonalMapper, DcDriver> implements PersonalService {

    @Autowired
    private PersonalMapper personalMapper;

    @Override
    public DcDriver findDriverByTel(String tel) {
        return personalMapper.findDriverByTel(tel);
    }

    @Override
    public DcDriver selectByTel(String tel) {
        LambdaQueryWrapper<DcDriver> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(DcDriver::getTel, tel);
        DcDriver one = personalMapper.selectOne(lambdaQueryWrapper);
        if (one != null) {
            return one;
        } else {
            return null;
        }
    }

    @Override
    public List<NCard> findCardList() {
        return personalMapper.findCardList();
    }

    @Override
    public int updateAssetsQuan(String tel) {
        int i = personalMapper.updateAssetsQuan(tel);
        return i;
    }


    @Override
    public int updateCurrentWithdrawal(String tel, BigDecimal inputMoney) {
        int i = personalMapper.updateCurrentWithdrawal(tel, inputMoney);
        return i;
    }

    @Override
    public String insertNewWallet(String tel, @Param("withdrawMoney") Integer inputMoney) {
        return personalMapper.insertNewWallet(tel, inputMoney);
    }

    @Override
    public List<DcWithdraw> findAllWithdraw() {
        return personalMapper.findAllWithdraw();
    }


    @Override
    public List<RiderQueue> findAll(Integer did) {
        return personalMapper.findAll(did);
    }

    @Override
    public BigDecimal zichanzonge(Integer did) {
        return personalMapper.zichanzonge(did);
    }

    @Override
    public BigDecimal dangyueshouru(Integer did) {
        return personalMapper.dangyueshouru(did);
    }

    @Override
    public void updateSumMoney(BigDecimal withdrawMoney, String tel, Integer driverId) {
        personalMapper.updateSumMoney(withdrawMoney, tel, driverId);
    }

    @Override
    public BigDecimal dangyuetixian(Integer driverId) {
        return personalMapper.dangyuetixian(driverId);
    }

    @Override
    public void driverPrice(Integer id, BigDecimal totalAssets) {
        personalMapper.totalAssets(totalAssets, id);
    }



    @Override
    public void saveDriverPrice(Integer id, BigDecimal totalAssets) {
        personalMapper.saveDriverPrice(id, totalAssets);
    }




}

